//
//  FPHomeBannerModel.m
//  FinanceProject
//
//  Created by 陈显摆 on 2025/3/21.
//

#import "FPHomeBannerModel.h"

@implementation FPHomeBannerModel




+ (JSONKeyMapper *)keyMapper {
    
    return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{@"ID" : @"id" , @"description" : @"descriptionString"}];
}

+ (BOOL)propertyIsOptional:(NSString *)propertyName {
    
    return YES;
}


+ (void)getBannerListSuccess:(void (^)(NSInteger, NSString * _Nonnull, NSArray * _Nonnull))success failure:(void (^)(NSError * _Nonnull))failure {
    
    [[APIClient sharedInstance] requestWithURLString:[MAIN_URL stringByAppendingString:BANNER_LIST_URL] parameters:@{} type:HttpRequestTypePost success:^(id responseObject, NSString *msg, NSInteger code) {
        
        NSError *error;
        
        id object = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:&error];
        
        NSArray *list = [FPHomeBannerModel arrayOfModelsFromDictionaries:[object objectForKey:@"data"] error:&error];
        
        NSInteger httpCode = [[object objectForKey:@"code"] integerValue];
        
        NSString *message = [object objectForKey:@"msg"];
        
        if (success) {
            
            success(httpCode , message , list);
        }
        
    } failure:^(NSError *error) {
        
        if (failure) {
            failure(error);
        }
    }];
}



@end
